﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Assist;
using Autodesk.Revit.DB;
using YArchitech.Revit;
using YJKArch.Utils;

namespace ModelValidation.AdjoinFireZone
{
	internal class CheckPointManage
	{
		public CheckPointManage(Autodesk.Revit.DB.Document doc, ViewPlan curViewPlan, List<Wall> lstOutWalls, Dictionary<XYZ, XYZ> dictCrossPoints, WindowHandle hWndRevit)
		{
			this.m_curDoc = doc;
			this.m_curViewPlan = curViewPlan;
			this.m_lstOutWalls = lstOutWalls;
			this.m_dictCrossPoints = dictCrossPoints;
			this.m_hWndRevit = hWndRevit;
		}

		public List<CheckPairWinDoorHorInfo> GetCheckResult()
		{
			return this.m_lstCheckInfo;
		}

		public bool CheckPairDoorWinTol()
		{
			foreach (KeyValuePair<XYZ, XYZ> keyValuePair in this.m_dictCrossPoints)
			{
				CheckPairWinDoorHorInfo checkPairWinDoorHorInfo = null;
				if (this.CheckPairDoorWinByPoint(ref checkPairWinDoorHorInfo, keyValuePair.Key, keyValuePair.Value) && checkPairWinDoorHorInfo != null)
				{
					checkPairWinDoorHorInfo.m_bIsFireWinDoor1 = CheckPointManage.IsFireDoorWin(checkPairWinDoorHorInfo.m_eleWinDoor1);
					checkPairWinDoorHorInfo.m_bIsFireWinDoor2 = CheckPointManage.IsFireDoorWin(checkPairWinDoorHorInfo.m_eleWinDoor2);
					if (!checkPairWinDoorHorInfo.m_bIsFireWinDoor1 || !checkPairWinDoorHorInfo.m_bIsFireWinDoor2)
					{
						this.m_lstCheckInfo.Add(checkPairWinDoorHorInfo);
					}
				}
			}
			return true;
		}

		private bool CheckPairDoorWinByPoint(ref CheckPairWinDoorHorInfo checkPairInfo, XYZ ptCross, XYZ vtCross)
		{
			new List<CheckPairWinDoorHorInfo>();
			List<Wall> list = new List<Wall>();
			foreach (Wall wall in this.m_lstOutWalls)
			{
				if (FindCrossPointsHorFireZone.IsPointOnWall(ptCross, wall) && !list.Contains(wall))
				{
					list.Add(wall);
				}
			}
			if (list.Count == 0)
			{
				return false;
			}
			if (list.Count == 1)
			{
				Wall curWall = list[0];
				return this.FindCheckPairDoorWin(ref checkPairInfo, ptCross, vtCross, curWall);
			}
			Wall curWallS = list[0];
			Wall curWallE = list[1];
			return this.FindCheckPairDoorWin(ref checkPairInfo, ptCross, vtCross, curWallS, curWallE);
		}

		private bool FindCheckPairDoorWin(ref CheckPairWinDoorHorInfo checkPairInfo, XYZ ptCross, XYZ vtCross, Wall curWall)
		{
			FamilyInstance familyInstance = null;
			FamilyInstance familyInstance2 = null;
			XYZ xyz = null;
			XYZ xyz2 = null;
			XYZ xyz3 = null;
			XYZ xyz4 = null;
			FindCrossPointsHorFireZone.GetWallEndPoints(ref xyz3, ref xyz4, curWall);
			xyz3 = CheckPointManage.Pt3ToP2(xyz3);
			xyz4 = CheckPointManage.Pt3ToP2(xyz4);
			double num = AssistFunc.feetToMM(ptCross.DistanceTo(xyz3)) / 1000.0;
			double num2 = AssistFunc.feetToMM(ptCross.DistanceTo(xyz4)) / 1000.0;
			List<FamilyInstance> doorWinOnWall = CheckPointManage.GetDoorWinOnWall(curWall, this.m_curDoc, this.m_curViewPlan);
			bool doorWinNearCrossPt = this.GetDoorWinNearCrossPt(ref familyInstance, ref xyz, ptCross, xyz3, curWall, doorWinOnWall);
			bool doorWinNearCrossPt2 = this.GetDoorWinNearCrossPt(ref familyInstance2, ref xyz2, ptCross, xyz4, curWall, doorWinOnWall);
			if (!doorWinNearCrossPt || !doorWinNearCrossPt2)
			{
				if (num >= CheckPointManage.m_dMinDistStandard && num2 >= CheckPointManage.m_dMinDistStandard)
				{
					if (doorWinNearCrossPt && doorWinNearCrossPt2)
					{
						double num3 = AssistFunc.feetToMM(ptCross.DistanceTo(xyz)) / 1000.0;
						double num4 = AssistFunc.feetToMM(ptCross.DistanceTo(xyz2)) / 1000.0;
						double num5 = num3 + num4;
						num5 = Math.Round(num5, 2);
						if (num5 < CheckPointManage.m_dMinDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num5, false);
							return true;
						}
						AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						return false;
					}
				}
				else
				{
					Wall wall = null;
					Wall wall2 = null;
					XYZ xyz5 = null;
					XYZ xyz6 = null;
					if (num < CheckPointManage.m_dMinDistStandard && !doorWinNearCrossPt)
					{
						wall = this.FindConnectWall(curWall, xyz3);
						if (wall == null)
						{
							return false;
						}
						xyz5 = CheckPointManage.GetWallOtherPoint(wall, xyz3);
						List<FamilyInstance> doorWinOnWall2 = CheckPointManage.GetDoorWinOnWall(wall, this.m_curDoc, this.m_curViewPlan);
						if (!this.GetDoorWinNearCrossPt(ref familyInstance, ref xyz, xyz3, xyz5, wall, doorWinOnWall2))
						{
							return false;
						}
					}
					if (num2 < CheckPointManage.m_dMinDistStandard && !doorWinNearCrossPt2)
					{
						wall2 = this.FindConnectWall(curWall, xyz4);
						if (wall2 == null)
						{
							return false;
						}
						xyz6 = CheckPointManage.GetWallOtherPoint(wall2, xyz4);
						List<FamilyInstance> doorWinOnWall3 = CheckPointManage.GetDoorWinOnWall(wall2, this.m_curDoc, this.m_curViewPlan);
						if (!this.GetDoorWinNearCrossPt(ref familyInstance2, ref xyz2, xyz4, xyz6, wall2, doorWinOnWall3))
						{
							return false;
						}
					}
					if (wall != null && wall2 == null)
					{
						XYZ vt = xyz5 - xyz3;
						XYZ vt2 = xyz4 - xyz3;
						if (this.IsAngleLessThan180(this.CalVectAngle(vt, vt2, vtCross)))
						{
							double num6 = xyz3.DistanceTo(xyz);
							double num7 = xyz3.DistanceTo(xyz2);
							double num8 = AssistFunc.feetToMM(num6 + num7) / 1000.0;
							num8 = Math.Round(num8, 2);
							if (num8 < CheckPointManage.m_dMinDistStandard)
							{
								checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num8, true);
								return true;
							}
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
							return false;
						}
						else
						{
							double num8 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
							num8 = Math.Round(num8, 2);
							if (num8 < CheckPointManage.m_dMaxDistStandard)
							{
								checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num8, false);
								return true;
							}
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
							return false;
						}
					}
					else if (wall == null && wall2 != null)
					{
						XYZ vt3 = xyz6 - xyz4;
						XYZ vt4 = xyz3 - xyz4;
						if (this.IsAngleLessThan180(this.CalVectAngle(vt4, vt3, vtCross)))
						{
							double num9 = xyz4.DistanceTo(xyz);
							double num10 = xyz4.DistanceTo(xyz2);
							double num11 = AssistFunc.feetToMM(num9 + num10) / 1000.0;
							num11 = Math.Round(num11, 2);
							if (num11 < CheckPointManage.m_dMinDistStandard)
							{
								checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num11, true);
								return true;
							}
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
							return false;
						}
						else
						{
							double num11 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
							num11 = Math.Round(num11, 2);
							if (num11 < CheckPointManage.m_dMaxDistStandard)
							{
								checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num11, false);
								return true;
							}
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
							return false;
						}
					}
					else if (xyz != null && xyz2 != null)
					{
						double num12 = AssistFunc.feetToMM(xyz2.DistanceTo(xyz)) / 1000.0;
						num12 = Math.Round(num12, 2);
						if (num12 < CheckPointManage.m_dMaxDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num12, false);
							return true;
						}
						AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						return false;
					}
				}
				return true;
			}
			double num13 = AssistFunc.feetToMM(ptCross.DistanceTo(xyz)) / 1000.0;
			double num14 = AssistFunc.feetToMM(ptCross.DistanceTo(xyz2)) / 1000.0;
			double num15 = num13 + num14;
			num15 = Math.Round(num15, 2);
			if (num15 < CheckPointManage.m_dMinDistStandard)
			{
				checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num15, true);
				return true;
			}
			AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
			return false;
		}

		private bool FindCheckPairDoorWin(ref CheckPairWinDoorHorInfo checkPairInfo, XYZ ptCross, XYZ vtCross, Wall curWallS, Wall curWallE)
		{
			FamilyInstance familyInstance = null;
			FamilyInstance familyInstance2 = null;
			XYZ xyz = null;
			XYZ xyz2 = null;
			XYZ wallOtherPoint = CheckPointManage.GetWallOtherPoint(curWallS, ptCross);
			XYZ wallOtherPoint2 = CheckPointManage.GetWallOtherPoint(curWallE, ptCross);
			XYZ vt = wallOtherPoint - ptCross;
			XYZ vt2 = wallOtherPoint2 - ptCross;
			AssistFunc.feetToMM(ptCross.DistanceTo(wallOtherPoint));
			AssistFunc.feetToMM(ptCross.DistanceTo(wallOtherPoint2));
			List<FamilyInstance> doorWinOnWall = CheckPointManage.GetDoorWinOnWall(curWallS, this.m_curDoc, this.m_curViewPlan);
			List<FamilyInstance> doorWinOnWall2 = CheckPointManage.GetDoorWinOnWall(curWallE, this.m_curDoc, this.m_curViewPlan);
			bool doorWinNearCrossPt = this.GetDoorWinNearCrossPt(ref familyInstance, ref xyz, ptCross, wallOtherPoint, curWallS, doorWinOnWall);
			bool doorWinNearCrossPt2 = this.GetDoorWinNearCrossPt(ref familyInstance2, ref xyz2, ptCross, wallOtherPoint2, curWallE, doorWinOnWall2);
			if (doorWinNearCrossPt && doorWinNearCrossPt2)
			{
				if (this.IsAngleLessThan180(this.CalVectAngle(vt, vt2, vtCross)))
				{
					double num = ptCross.DistanceTo(xyz);
					double num2 = ptCross.DistanceTo(xyz2);
					double num3 = AssistFunc.feetToMM(num + num2) / 1000.0;
					num3 = Math.Round(num3, 2);
					if (num3 < CheckPointManage.m_dMinDistStandard)
					{
						checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, true);
					}
					else
					{
						AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
					}
				}
				else
				{
					double num3 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
					num3 = Math.Round(num3, 2);
					if (num3 < CheckPointManage.m_dMaxDistStandard)
					{
						checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, false);
					}
					else
					{
						AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
					}
				}
			}
			else
			{
				if (!doorWinNearCrossPt)
				{
					Wall wall = this.FindConnectWall(curWallS, wallOtherPoint);
					if (wall == null)
					{
						return false;
					}
					List<FamilyInstance> doorWinOnWall3 = CheckPointManage.GetDoorWinOnWall(curWallS, this.m_curDoc, this.m_curViewPlan);
					if (doorWinOnWall3 == null || doorWinOnWall3.Count == 0)
					{
						return false;
					}
					XYZ wallOtherPoint3 = CheckPointManage.GetWallOtherPoint(wall, wallOtherPoint);
					if (!this.GetDoorWinNearCrossPt(ref familyInstance, ref xyz, wallOtherPoint, wallOtherPoint3, wall, doorWinOnWall3))
					{
						return false;
					}
				}
				if (!doorWinNearCrossPt2)
				{
					Wall wall2 = this.FindConnectWall(curWallE, wallOtherPoint2);
					if (wall2 == null)
					{
						return false;
					}
					List<FamilyInstance> doorWinOnWall4 = CheckPointManage.GetDoorWinOnWall(wall2, this.m_curDoc, this.m_curViewPlan);
					if (doorWinOnWall4 == null || doorWinOnWall4.Count == 0)
					{
						return false;
					}
					XYZ wallOtherPoint4 = CheckPointManage.GetWallOtherPoint(wall2, wallOtherPoint2);
					if (!this.GetDoorWinNearCrossPt(ref familyInstance2, ref xyz2, wallOtherPoint2, wallOtherPoint4, wall2, doorWinOnWall4))
					{
						return false;
					}
				}
				if (doorWinNearCrossPt && !doorWinNearCrossPt2)
				{
					vt = wallOtherPoint - wallOtherPoint2;
					vt2 = xyz2 - wallOtherPoint2;
					if (this.IsAngleLessThan180(this.CalVectAngle(vt, vt2, vtCross)))
					{
						double num4 = wallOtherPoint2.DistanceTo(xyz);
						double num5 = wallOtherPoint2.DistanceTo(xyz2);
						double num3 = AssistFunc.feetToMM(num4 + num5) / 1000.0;
						num3 = Math.Round(num3, 2);
						if (num3 < CheckPointManage.m_dMinDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, true);
						}
						else
						{
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						}
					}
					else
					{
						double num3 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
						num3 = Math.Round(num3, 2);
						if (num3 < CheckPointManage.m_dMaxDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, false);
						}
						else
						{
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						}
					}
				}
				else if (!doorWinNearCrossPt && doorWinNearCrossPt2)
				{
					vt = wallOtherPoint2 - wallOtherPoint;
					vt2 = xyz - wallOtherPoint;
					if (this.IsAngleLessThan180(this.CalVectAngle(vt, vt2, vtCross)))
					{
						double num6 = wallOtherPoint.DistanceTo(xyz);
						double num7 = wallOtherPoint.DistanceTo(xyz2);
						double num3 = AssistFunc.feetToMM(num6 + num7) / 1000.0;
						num3 = Math.Round(num3, 2);
						if (num3 < CheckPointManage.m_dMinDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, true);
						}
						else
						{
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						}
					}
					else
					{
						double num3 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
						num3 = Math.Round(num3, 2);
						if (num3 < CheckPointManage.m_dMaxDistStandard)
						{
							checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, false);
						}
						else
						{
							AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
						}
					}
				}
				else
				{
					double num3 = AssistFunc.feetToMM(xyz.DistanceTo(xyz2)) / 1000.0;
					num3 = Math.Round(num3, 2);
					if (num3 < CheckPointManage.m_dMaxDistStandard)
					{
						checkPairInfo = this.GetCheckInfo(familyInstance, familyInstance2, num3, false);
					}
					else
					{
						AdjoinFireZoneCheck.DeletePairDoorWinTrustInfo(familyInstance, familyInstance2, this.m_curDoc);
					}
				}
			}
			return true;
		}

		private double CalVectAngle(XYZ vt1, XYZ vt2, XYZ vtMid)
		{
			vt1 = vt1.Normalize();
			vt2 = vt2.Normalize();
			double num = vt1.AngleOnPlaneTo(vt2, XYZ.BasisZ);
			double num2 = vt1.AngleOnPlaneTo(vtMid, XYZ.BasisZ);
			double num3 = vtMid.AngleOnPlaneTo(vt2, XYZ.BasisZ);
			if (Geometry.GreaterThan(num2 + num3, num))
			{
				num = vt2.AngleOnPlaneTo(vt1, XYZ.BasisZ);
			}
			return num * 180.0 / Math.PI;
		}

		public static bool IsFireDoorWin(FamilyInstance familyInstance)
		{
			string name = familyInstance.Symbol.Family.Name;
			string name2 = familyInstance.Symbol.Name;
			if (CheckPointManage.IsStringIncludeFireInfo(name) || CheckPointManage.IsStringIncludeFireInfo(name2))
			{
				return true;
			}
			Parameter parameter = familyInstance.Symbol.GetParameter(BuiltInParameter.ALL_MODEL_TYPE_MARK);
			if (parameter != null && CheckPointManage.IsStringIncludeFireInfo(parameter.AsString()))
			{
				return true;
			}
			Parameter parameter2 = familyInstance.GetParameter("防火等级");
			if (parameter2 != null && CheckPointManage.IsStringIncludeFireInfo(parameter2.AsString()))
			{
				return true;
			}
			Parameter parameter3 = familyInstance.Symbol.GetParameter(BuiltInParameter.DOOR_FIRE_RATING);
			return parameter3 != null && CheckPointManage.IsStringIncludeFireInfo(parameter3.AsString());
		}

		public static bool IsStringIncludeFireInfo(string strInfo)
		{
			return strInfo != null && !(strInfo == "") && (Regex.IsMatch(strInfo, "FM|甲") || Regex.IsMatch(strInfo, "FM|乙") || Regex.IsMatch(strInfo, "FM|特") || Regex.IsMatch(strInfo, "FJM|特") || Regex.IsMatch(strInfo, "FC|甲") || Regex.IsMatch(strInfo, "FC|乙") || Regex.IsMatch(strInfo, "FC|特"));
		}

		private bool IsAngleLessThan180(double dAngle)
		{
			return !Geometry.GreaterThan(dAngle, 180.0);
		}

		private CheckPairWinDoorHorInfo GetCheckInfo(FamilyInstance eleDoorWin1, FamilyInstance eleDoorWin2, double dCalDist, bool bLessThan180)
		{
			return new CheckPairWinDoorHorInfo
			{
				m_strViewPlanName = this.m_curViewPlan.Name,
				m_eleWinDoor1 = eleDoorWin1,
				m_eleWinDoor2 = eleDoorWin2,
				m_dStandardDist = (bLessThan180 ? CheckPointManage.m_dMinDistStandard : CheckPointManage.m_dMaxDistStandard),
				m_dCalDist = dCalDist
			};
		}

		public static XYZ GetWallOtherPoint(Wall curWall, XYZ ptWallEnd)
		{
			XYZ xyz = null;
			XYZ xyz2 = null;
			FindCrossPointsHorFireZone.GetWallEndPoints(ref xyz, ref xyz2, curWall);
			xyz = CheckPointManage.Pt3ToP2(xyz);
			xyz2 = CheckPointManage.Pt3ToP2(xyz2);
			ptWallEnd = CheckPointManage.Pt3ToP2(ptWallEnd);
			if (ptWallEnd.DistanceTo(xyz) < ptWallEnd.DistanceTo(xyz2))
			{
				return xyz2;
			}
			return xyz;
		}

		private Wall FindConnectWall(Wall wallKnown, XYZ ptWallCross)
		{
			foreach (Wall wall in this.m_lstOutWalls)
			{
				if (wall != wallKnown && FindCrossPointsHorFireZone.IsPointOnWall(ptWallCross, wall))
				{
					return wall;
				}
			}
			return null;
		}

		private bool GetDoorWinNearCrossPt(ref FamilyInstance eleFind, ref XYZ ptNear, XYZ ptCross, XYZ ptEnd, Wall wallOn, List<FamilyInstance> lstDoorWin)
		{
			double num = -1.0;
			foreach (FamilyInstance familyInstance in lstDoorWin)
			{
				XYZ xyz = DoorWinAssistFunc.GetBoundPt(familyInstance, wallOn, 0);
				XYZ xyz2 = DoorWinAssistFunc.GetBoundPt(familyInstance, wallOn, 1);
				xyz = (wallOn.Location as LocationCurve).Curve.Project(xyz).XYZPoint;
				xyz2 = (wallOn.Location as LocationCurve).Curve.Project(xyz2).XYZPoint;
				xyz = CheckPointManage.Pt3ToP2(xyz);
				xyz2 = CheckPointManage.Pt3ToP2(xyz2);
				XYZ xyz3 = (ptEnd - ptCross).Normalize();
				XYZ xyz4;
				if (ptCross.IsAlmostEqualTo(CheckPointManage.GetWallOtherPoint(wallOn, ptCross)))
				{
					xyz4 = (xyz - ptCross).Normalize();
					if (!xyz3.IsAlmostEqualTo(xyz4))
					{
						continue;
					}
				}
				double num2 = ptCross.DistanceTo(xyz);
				double num3 = ptCross.DistanceTo(xyz2);
				XYZ xyz5;
				double num4;
				if (num2 < num3)
				{
					xyz5 = xyz;
					num4 = num2;
				}
				else
				{
					xyz5 = xyz2;
					num4 = num3;
				}
				xyz4 = (xyz5 - ptCross).Normalize();
				if (xyz3.IsAlmostEqualTo(xyz4) && (num < 0.0 || num > num4))
				{
					num = num4;
					eleFind = familyInstance;
					ptNear = xyz5;
				}
			}
			return num >= 0.0;
		}

		public static List<FamilyInstance> GetDoorWinOnWall(Wall wall, Autodesk.Revit.DB.Document curDoc, ViewPlan viewPlan)
		{
			List<FamilyInstance> list = new List<FamilyInstance>();
			IList<FamilyInstance> list2 = null;
			IList<FamilyInstance> list3 = null;
			if (wall.Document.IsLinked)
			{
				Document document = wall.Document;
				ViewPlan viewPlanFromName = FindCrossPointsHorFireZone.GetViewPlanFromName(viewPlan.Name, document);
				if (viewPlanFromName != null)
				{
					list2 = WallAssistFunc.GetWallAssoDoorWins(document, wall, BuiltInCategory.OST_Doors, viewPlanFromName.GenLevel);
					list3 = WallAssistFunc.GetWallAssoDoorWins(document, wall, BuiltInCategory.OST_Windows, viewPlanFromName.GenLevel);
				}
			}
			else
			{
				list2 = WallAssistFunc.GetWallAssoDoorWins(curDoc, wall, BuiltInCategory.OST_Doors, viewPlan.GenLevel);
				list3 = WallAssistFunc.GetWallAssoDoorWins(curDoc, wall, BuiltInCategory.OST_Windows, viewPlan.GenLevel);
			}
			if (list2 != null)
			{
				list.AddRange(list2);
			}
			if (list3 != null)
			{
				list.AddRange(list3);
			}
			return list;
		}

		public static XYZ Pt3ToP2(XYZ pt)
		{
			return new XYZ(pt.X, pt.Y, 0.0);
		}

		private Document m_curDoc;

		private ViewPlan m_curViewPlan;

		private Dictionary<XYZ, XYZ> m_dictCrossPoints;

		private List<Wall> m_lstOutWalls;

		private static double m_dMinDistStandard = 2.0;

		private static double m_dMaxDistStandard = 4.0;

		private List<CheckPairWinDoorHorInfo> m_lstCheckInfo = new List<CheckPairWinDoorHorInfo>();

		private WindowHandle m_hWndRevit;
	}
}
